part of '../page.dart';

class _LexicalItemTile extends StatelessWidget {
  const _LexicalItemTile({
    required this.title,
    required this.onPressed,
    this.translation,
    this.progressInfo,
  });

  final String title;
  final String? translation;
  final String? progressInfo;
  final VoidCallback onPressed;

  @override
  Widget build(BuildContext context) {
    final titleText = Text.rich(
      TextSpan(
        children: [
          TextSpan(
            text: title,
            style: CoreTheme.of(context).textTheme.tileBoldTitle,
          ),
          if (translation != null)
            TextSpan(
              text: '  –  $translation',
              style: CoreTheme.of(context).textTheme.tileTitle,
            ),
        ],
      ),
      textWidthBasis: TextWidthBasis.longestLine,
    );

    const trailing = TileNavigationIndicator();

    return PressableTextTile(
      titleText: titleText,
      subtitle: progressInfo,
      onPressed: onPressed,
      trailing: trailing,
    );
  }
}
